/**
 *   Copyright 2011 - 2017 OSBI Ltd
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */

/* ==========================================================================
    BOX GRID
   ========================================================================== */

/*  GENERAL GRID STYLES
   ========================================================================== */

.box-grid:before,
.box-grid:after {
  display: table;
  content: " ";
}

.box-grid:after {
  clear: both;
}

.box-grid {
  margin: 0;
  padding: 0 0 50px 0;
  list-style: none;
}

/* grid item */

.box-grid li {
  float: left;
  width: 33%;
  height: 420px;
  border-top: 1px solid $gray;
  text-align: center;
}

/*
 * we are using a combination of borders and
 * box shadows to control the grid lines
 */

.box-grid li:nth-child(-n+3) {
  border-top: none;
}

.box-grid li:nth-child(3n-1),
.box-grid li:nth-child(3n-2) {
  box-shadow: 1px 0 0 $gray;
}

/* anchor style */

.box-grid li > a {
  display: block;
  height: 100%;
  color: $saiku;
  transition: background .2s;
}

/* the icon with pseudo class for icon font */

.box-icon {
  display: block;
  padding: 30px 0 0 0;
  transition: transform .2s;
}

.box-icon:before {
  font-family: $font-icon;
  font-size: 7em;
  font-weight: normal;
  font-style: normal;
  font-variant: normal;
  line-height: 1.9;
  text-transform: none;
  speak: none;
  -webkit-font-smoothing: antialiased;
     -moz-font-smoothing: antialiased;
}

/* title element */

.box-grid .box-title {
  position: relative;
  margin: 20px 0 10px 0;
  padding: 20px 0 0 0;
  font-size: 2em;
  transition: transform .2s;
}

.box-grid .box-title:before {
  position: absolute;
  top: 0;
  left: 50%;
  width: 160px;
  height: 6px;
  margin: -10px 0 0 -80px;
  background: $saiku;
  content: "";
  transition: margin-top .2s;
}

.box-grid .box-subtitle {
  display: inline-block;
  font-size: 1em;
  opacity: 0;
  color: $white;
  transition: transform .3s, opacity .2s;
  transform: translateY(10px);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.box-grid li:hover .box-subtitle,
.touch .box-grid li .box-subtitle {
  opacity: 1;
  transform: translateY(0px);
}

/* hover styles */

.box-grid li > a:hover {
  background: $saiku;
}

.box-grid li > a:hover .box-icon {
  transform: translateY(10px);
}

.box-grid li > a:hover .box-icon:before,
.box-grid li > a:hover .box-title {
  color: $white;
}

.box-grid li > a:hover .box-title {
  transform: translateY(-30px);
}

.box-grid li > a:hover .box-title:before {
  margin-top: 80px;
  background: $white;
}

/*  GRID MEDIA QUERIES
   ========================================================================== */

@media screen and (max-width: 62.75em) {
  .box-grid li {
    width: 50%;
  }

  /* reset the grid lines */

  .box-grid li:nth-child(-n+3) {
    border-top: 1px solid $gray;
  }

  .box-grid li:nth-child(3n-1),
  .box-grid li:nth-child(3n-2) {
    box-shadow: none;
  }

  .box-grid li:nth-child(-n+2) {
    border-top: none;
  }

  .box-grid li:nth-child(2n-1) {
    box-shadow: 1px 0 0 $gray;
  }
}

@media screen and (max-width: 41.6em) {
  .box-grid li {
    width: 100%;
  }

  .box-grid li:nth-child(-n+2) {
    border-top: 1px solid $gray;
  }

  .box-grid li:nth-child(2n-1) {
    box-shadow: none;
  }

  .box-grid li:first-child {
    border-top: none;
  }
}

@media screen and (max-width: 25em) {
  .box-grid {
    font-size: 80%;
  }

  .box-grid .box-subtitle {
    margin-top: 20px;
  }
}
